﻿<!doctype html>
<html>
    <head>
        <title>jMiny Docs</title>
        <style type="text/css">
            * {margin:0;padding:0;list-style:none;font-size:inherit}
            body {font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:1.5}
            h1 {font-size:150%}
            header {padding:24px;background:#333;color:#fff}
            a {text-decoration:none}
            .method {padding:12px 24px;background:#ddd}
            .method:nth-child(even) {background:#eee}
            .signature {font-weight:bold;font-size:120%}
            .type {color:#999}
            .arg {color:#666}
            .related ul,
            .related li {display:inline}
            .related li:after {content: ', '}
            .related li:last-child:after {content:''}
        </style>
    </head>
    <body>
        <header>
            <h1>jMiny</h1>
            <h2>It's like jQuery, but without the fat</h2>
        </header>
        <ul id="methods"></ul>
        <script type='text/javascript' src='../jMiny.js'></script>
        <script type='text/javascript'>
            (function() {
                var methods = {
                    "jMiny.fn": {
                        isStatic: true,
                        type: 'object',
                        desc: 'Add new methods to jMiny.fn to extend jMiny objects.'
                    },
                    "jMiny.ajax": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Makes an AJAX request',
                                args: [
                                    {
                                        name: 'options',
                                        type: 'object',
                                        desc: 'Settings object containing multiple parameters',
                                        req: true,
                                        members: {
                                            async: {type: 'boolean', def: true, desc: 'Whether or not the request should be made asynchronously.'},
                                            cache: {type: 'boolean', def: true, desc: 'When false, a unique key is added to the URL to prevent caching.'},
                                            "complete(xhr, textStatus)": {type: 'function', def: null, desc: 'A callback to execute when the response has returned.'},
                                            data: {type: 'object', def: null, desc: 'Parameters to pass along with the request.'},
                                            dataType: {type: 'enum', values: 'text|html|xml|json', def: 'text', desc: 'The expected format of the response text'},
                                            "error(xhr, textStatus, errorThrown)": {type: 'function', def: null, desc: 'A callback to execute when the response has returned with an error status code'},
                                            "success(data, textStatus, xhr)": {type: 'function', def: null, desc: 'A callback to execute when the response has returned with a success status code'},
                                            timeout: {type: 'int', def: null, desc: 'The int of milliseconds to wait before the request times out (or null for the browser default)'},
                                            type: {type: 'enum', values: 'GET|POST', def: 'GET', desc: ''},
                                            url: {type: 'string', req: true, desc: 'The URL to request'}
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.each": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Iterates over a sequence',
                                args: [
                                    {
                                        name: 'list',
                                        type: 'Array',
                                        desc: 'The Array (or Array-like object) through which to iterate',
                                        req: true
                                    },
                                    {
                                        name: 'callback(index, item)',
                                        type: 'function',
                                        desc: 'The function to execute for each item in the Array',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.extend": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Adds additional properties onto an object',
                                ret: 'object',
                                args: [
                                    {
                                        name: 'subject',
                                        type: 'object',
                                        desc: 'The object which will receive the new or overriding properties',
                                        req: true
                                    },
                                    {
                                        name: 'extensions',
                                        type: 'object',
                                        desc: 'The object that provides the new or overriding properties',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.map": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Transforms an Array-like object into a new Array by applying a function to each item',
                                ret: 'Array',
                                args: [
                                    {
                                        name: 'list',
                                        type: 'Array',
                                        desc: 'The source Array through which to iterate',
                                        req: true
                                    },
                                    {
                                        name: 'callback(index, item)',
                                        type: 'function',
                                        desc: 'A function that will be executed for each item in the array',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.param": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Converts an object into a query string',
                                ret: 'string',
                                args: [
                                    {
                                        name: 'obj',
                                        type: 'object',
                                        desc: 'The object to convert into the query string',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.proxy": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Wraps a function with a set context (this)',
                                ret: 'function',
                                args: [
                                    {
                                        name: 'callback',
                                        type: 'function',
                                        desc: 'The function to be wrapped',
                                        req: true
                                    },
                                    {
                                        name: 'thisp',
                                        type: 'object',
                                        desc: 'The object that will be the resulting function\'s permanent context (this)',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.toArray": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Converts an Array-like object to an Array',
                                ret: 'Array',
                                args: [
                                    {
                                        name: 'list',
                                        type: 'Array',
                                        desc: 'The Array-like object to convert to an Array',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.trim": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Removes leading and trailing whitespace from a string',
                                ret: 'string',
                                args: [
                                    {
                                        name: 'str',
                                        type: 'string',
                                        desc: 'The string to be trimmed',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "jMiny.noConflict": {
                        isStatic: true,
                        sigs: [
                            {
                                desc: 'Releases control of the $ variable',
                                ret: 'jMiny'
                            }
                        ]
                    },
                    "[index]": {
                        type: 'HTMLElement',
                        desc: 'Gets the element at a zero-based index in the jMiny set'
                    },
                    length: {
                        type: 'int',
                        desc: 'The int of elements in the jMiny set'
                    },
                    toArray: {
                        sigs: [
                            {
                                desc: 'Gets all elements in the jMiny set as an Array',
                                ret: 'Array'
                            }
                        ]
                    },
                    add: {
                        sigs: [
                            {
                                desc: 'Adds matching elements to the jMiny set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'element',
                                        type: 'HTMLElement',
                                        desc: 'A DOM element',
                                        req: true
                                    }
                                ]
                            },
                            {
                                desc: 'Adds matching elements to the jMiny set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector',
                                        req: true
                                    },
                                    {
                                        name: 'root',
                                        type: 'HTMLElement',
                                        desc: 'The element whose descendants will be queried. If not supplied, the entire document is queried'
                                    }
                                ]
                            },
                            {
                                desc: 'Adds matching elements to the jMiny set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'html',
                                        type: 'string',
                                        desc: 'An HTML fragment string that will be parsed into DOM elements',
                                        req: true
                                    }
                                ]
                            },
                            {
                                desc: 'Adds matching elements to the jMiny set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'other',
                                        type: 'jMiny',
                                        desc: 'Another jMiny set whose contents will be appended to this set',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    children: {
                        sigs: [
                            {
                                desc: 'Gets all direct descendants of elements in the set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'When supplied, only elements matching the selector will be included in the result set'
                                    }
                                ]
                            }
                        ]
                    },
                    each: {
                        sigs: [
                            {
                                desc: 'Executes a callback for each element in the set',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'callback(index, element)',
                                        type: 'function',
                                        desc: 'The callback to execute for each element',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    eq: {
                        sigs: [
                            {
                                desc: 'Gets an element from the set as a jMiny object',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'index',
                                        type: 'int',
                                        desc: 'The zero-based index of the element in the set',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    "get": {
                        sigs: [
                            {
                                desc: 'Gets an element from the set',
                                ret: 'HTMLElement',
                                args: [
                                    {
                                        name: 'index',
                                        type: 'int',
                                        desc: 'The zero-based index of the element in the set',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    is: {
                        sigs: [
                            {
                                desc: 'Tests whether or not a set matches a selector',
                                ret: 'boolean',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to test against the set',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    filter: {
                        sigs: [
                            {
                                desc: 'Reduces the set to elements matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector that elements in the resulting set must match',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    not: {
                        sigs: [
                            {
                                desc: 'Reduces the set to elements that do not match the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector that elements in the resulting set do not match',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    find: {
                        sigs: [
                            {
                                desc: 'Finds all descendant elements matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against descendants',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    first: {
                        sigs: [
                            {
                                desc: 'Finds the first descendant element matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against descendants',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    last: {
                        sigs: [
                            {
                                desc: 'Finds the last descendant element matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against descendants',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    next: {
                        sigs: [
                            {
                                desc: 'Finds the next sibling element after this one matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against siblings',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    prev: {
                        sigs: [
                            {
                                desc: 'Finds the previous sibling element before this one matching the selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against siblings',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    parent: {
                        sigs: [
                            {
                                desc: 'Gets the immediate ancestor of this element',
                                ret: 'jMiny',
                                args: []
                            },
                            {
                                desc: 'Gets the immediate ancestor of this element if it matches a selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against the parent',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    parents: {
                        sigs: [
                            {
                                desc: 'Gets all ancestors of this element',
                                ret: 'jMiny',
                                args: []
                            },
                            {
                                desc: 'Gets all ancestors of this element matching a selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against the parents',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    },
                    closest: {
                        sigs: [
                            {
                                desc: 'Gets the first ancestor of this element',
                                ret: 'jMiny',
                                args: []
                            },
                            {
                                desc: 'Gets the first ancestor of this element matching a selector',
                                ret: 'jMiny',
                                args: [
                                    {
                                        name: 'selector',
                                        type: 'string',
                                        desc: 'A CSS selector to match against the parents',
                                        req: true
                                    }
                                ]
                            }
                        ]
                    }
                },
                related = [
                    ['eq', 'get', '[index]'],
                    ['toArray', 'jMiny.toArray', 'jMiny.map'],
                    ['each', 'jMiny.each'],
                    ['find', 'children', 'parent', 'parents', 'closest', 'first', 'last', 'next', 'prev'],
                    ['filter', 'not'],
                    ['attr', 'removeAttr', 'data', 'removeData', 'val'],
                    ['addClass', 'hasClass', 'removeClass', 'toggleClass', 'css'],
                    ['animate', 'css'],
                    ['html', 'text', 'empty', 'append', 'prepend'],
                    ['css', 'height', 'width', 'offset', 'position'],
                    ['offset', 'position', 'offsetParent', 'scrollTop', 'scrollLeft'],
                    ['focus'],
                    ['submit'],
                    ['off', 'on', 'one'],
                    ['clone'],
                    ['remove', 'empty'],
                    ['before', 'insertBefore', 'after', 'insertAfter'],
                    ['before', 'insertBefore', 'prepend', 'prependTo'],
                    ['after', 'insertAfter', 'append', 'appendTo'],
                    ['replaceAll', 'replaceWith', 'remove'],
                    ['jMiny.ajax', 'jMiny.param'],
                    ['parent', 'parents', 'closest']
                ]
                    /*
attr
removeAttr
addClass
hasClass
removeClass
toggleClass
css
data
removeData
animate
append
appendTo
prepend
prependTo
before
insertBefore
after
insertAfter
replaceAll
replaceWith
remove
clone
empty
html
text
on
off
one
height
width
offset
offsetParent
position
scrollTop
scrollLeft
focus
submit
val
                    */
                var buffer = [];
                function getRelated(method) {
                    var i = -1,
                        items,
                        item,
                        j,
                        k,
                        result = [];
                    while (items = related[++i]) {
                        j = -1;
                        while (item = items[++j]) {
                            if (item == method) {
                                k = -1;
                                while (item = items[++k]) {
                                    if (item != method) {
                                        result.push('<li><a href="#m-', item, '">', item, '</a></li>')
                                    }
                                }
                                break;
                            }
                        }
                    }
                    return '<ul>' + result.join('') + '</ul>';
                }
                for (var method in methods) {
                    var o = methods[method],
                        i = -1,
                        sig;
                    if (!o.type || o.type == 'function') {
                        while (sig = o.sigs[++i]) {
                            buffer.push('<li class="method" id="m-', method, '"><code><span class="signature" title="return ', sig.ret ? sig.ret : 'void', '">', method, '(<span class="args">');
                            if (sig.args) {
                                var j = -1,
                                    arg,
                                    argList = [];
                                while (arg = sig.args[++j]) {
                                    argList.push(['<span class="arg" title="', arg.type, ' ', arg.req ? '(required)' : '(optional)', '\n', arg.desc, '">', arg.name, '</span>'].join(''))
                                }
                                buffer.push(argList.join(', '));
                            }
                            buffer.push('</span>)</span><span class="type">:', sig.ret ? sig.ret : 'void</span>', '</code><p>', sig.desc || o.desc, '</p><div class="related">See also: ', getRelated(method), '</div></li>');
                        }
                    }
                    else {
                        buffer.push('<li class="method" id="m-', method, '"><code><span class="signature">', method, '</span><span class="type">:', o.type, '</span></code><p>', o.desc, '</p></li>');
                    }
                }
                document.getElementById('methods').innerHTML = buffer.join('');
            })();
        </script>
    </body>
</html>